package jwcb.javapjframework.ms_template.service.controller;

import jwcb.javapjframework.common.domain.domain.R;
import jwcb.javapjframework.common.domain.domain.ResultCode;
import jwcb.javapjframework.common.domain.exception.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/test")
public class TestController {


    private static final Logger log = LoggerFactory.getLogger(TestController.class);

    @GetMapping("/info")
    public void info() {
        log.info("接口调用测试");
    }

    @GetMapping("/testExceptionHandler")
    public R<Void> testError(int id) {
        if (id < 0) {
            throw new ServiceException(ResultCode.INVALID_CODE);
        }
        return R.ok();
    }
}
